// Copyright (c) Appeon. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

using System;

namespace SnapObjects.Data
{
    /// <summary>
    ///     Specifies the strategy to be used when saving data for a property to the database.
    /// </summary>
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
    public class PropertySaveAttribute : Attribute, IPropertySave
    {
        /// <summary>
        ///     Initializes a new instance of the PropertySaveAttribute class.
        /// </summary>
        /// <param name="saveStrategy">The strategy to be used when saving data for the current property to the database.</param>
        public PropertySaveAttribute(SaveStrategy saveStrategy)
        {
            this.SaveStrategy = saveStrategy;
        }

        /// <summary>
        ///     Gets the strategy that is used when saving data for the current property to the database.
        /// </summary>
        public SaveStrategy SaveStrategy { get; }
    }
}
